//
//  RW_HeaderCollectionViewCell.m
//  SleepApp
//
//  Created by MAC on 2021/4/7.
//  Copyright © 2021 RiceWang. All rights reserved.
//

#import "RW_HeaderCollectionViewCell.h"
@interface RW_HeaderCollectionViewCell ()
@property (nonatomic,strong) UILabel *nick_name_label;
@property (nonatomic,strong) UILabel *desc_label;

@end
@implementation RW_HeaderCollectionViewCell
-(void)bind_row_data:(WLBaseCollectionViewLayerRow *)sender{
    if ([sender.data isKindOfClass:RW_HeaderCollectionViewCellModel.class]){
        RW_HeaderCollectionViewCellModel *model = sender.data;
        self.nick_name_label.text = model.nick_name_string;
        self.desc_label.text = model.desc_string;
    }
}
-(void)bind_delegate:(id)sender{
    
}


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = UIColor.whiteColor;
        self.layer.cornerRadius = 8;
        
        [self addSubview:self.nick_name_label];
        [self addSubview:self.desc_label];
        [self.nick_name_label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self).mas_offset(10);
            make.top.mas_equalTo(self).mas_offset(10);
        }];
        [self.desc_label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.nick_name_label);
            make.bottom.mas_equalTo(self).mas_offset(-10);
        }];
    }
    return self;
}
-(UILabel *)nick_name_label{
    if (!_nick_name_label){
        _nick_name_label = [[UILabel alloc]init];
        _nick_name_label.font = [UIFont systemFontOfSize:19 weight:UIFontWeightMedium];
        _nick_name_label.textColor = HexColor(@"333333");
    }
    return _nick_name_label;
}
-(UILabel *)desc_label{
    if (!_desc_label){
        _desc_label = [[UILabel alloc]init];
        _desc_label.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
        _desc_label.textColor = HexColor(@"888888");
    }
    return _desc_label;
}
@end

@implementation RW_HeaderCollectionViewCellModel
-(NSString *)nick_name_string{
    if (!_nick_name_string){
        _nick_name_string = self.user_model.nickName?self.user_model.nickName:@"游客(点击登录)";
    }
    return _nick_name_string;
}
-(NSString *)desc_string{
    if (!_desc_string){
        _desc_string = @"欢迎来到令人安静的APP";
    }
    return _desc_string;
}
@end
